import json
from urllib import request

url = "https://httpbin.org/get"
# 1.使用request模块发送请求
res = request.urlopen(url,)
print(res)
# 2.获取响应内容
content_bytes = res.read()
print(content_bytes)
# 3.字节流转换为字符串
content = content_bytes.decode()
print(content)
# 4.字符串转换为字典(反序列化)
data = json.loads(content)
print(data['headers']['User-Agent'])


